<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
    </head>
    <body>
        <table border="1">
            <tr>
                <th>商品</th>
                <th>价格</th>
            </tr>
            <tr>
                <td>T恤</td>
                <td id="xg">￥100</td>
            </tr>
            <tr>
                <td>牛仔褂</td>
                <td id="oper1">250</td>
            </tr>
            <tr>
                <td>牛仔库</td>
                <td id="oper2">150</td>
            </tr>
        </table>
        <script type="text/javascript">
            function myFunction() {
                var num1 = document.getElementById('oper1').innerText;
                var num2 = document.getElementById('oper2').innerText;
                var xtd = document.getElementById('xg');
                xtd.innerHTML = num1 - num2;
            }
        </script>
        <p onclick="myFunction()"></p>
    </body>

</html>